﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/MasterPage/Admin.Master"
    CodeBehind="SearchResults.aspx.vb" Inherits="GoodAnotApp.SearchResults" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <style type="text/css">
        .style2
        {
            width: 717px;
            height: 29px;
        }
        .style4
        {
            height: 117px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div id="SearchResult" style="top: 300px; margin-left: 10px; width: 945px;">
        <table style="width: 100%">
            <tr align="right">
                <td align="right">
                    <table width="100%" style="margin-bottom: 0px">
                        <tr>
                            <td class="sortByContainer">
                                <strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Sort by:</strong>&nbsp;
                                <asp:LinkButton ID="lbSortDate" runat="server" ForeColor="#FF9933">Date </asp:LinkButton>
                                &nbsp;
                                <asp:Image ID="imgDateAsc" runat="server" ImageUrl="~/Styles/Images/sortUp.gif" />
                                <asp:Image ID="imgDateDesc" runat="server" ImageUrl="~/Styles/Images/sortDown.gif" />
                                &nbsp;
                                <asp:HiddenField ID="hfSort" runat="server" Value="date" />
                                <asp:HiddenField ID="hfAscDesc" runat="server" Value="desc" />
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr>
                <td class="style2">
                    <asp:ListView ID="ListView2" runat="server" DataSourceID="SqlDataSourceSearchResults"
                        DataKeyNames="outlet_ID">
                        <EditItemTemplate>
                            <span style="">name:
                                <asp:TextBox ID="nameTextBox" runat="server" Text='<%# Bind("name") %>' />
                                <br />
                                website:
                                <asp:TextBox ID="websiteTextBox" runat="server" Text='<%# Bind("website") %>' />
                                <br />
                                details:
                                <asp:TextBox ID="detailsTextBox" runat="server" Text='<%# Bind("details") %>' />
                                <br />
                                outletName:
                                <asp:TextBox ID="outletNameTextBox" runat="server" Text='<%# Bind("outletName") %>' />
                                <br />
                                outlet_ID:
                                <asp:Label ID="outlet_IDLabel1" runat="server" Text='<%# Eval("outlet_ID") %>' />
                                <br />
                                priority:
                                <asp:TextBox ID="priorityTextBox" runat="server" Text='<%# Bind("priority") %>' />
                                <br />
                                <asp:Button ID="UpdateButton" runat="server" CommandName="Update" Text="Update" />
                                <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" Text="Cancel" />
                                <br />
                                <br />
                            </span>
                        </EditItemTemplate>
                        <EmptyDataTemplate>
                            <span>No data was returned.</span>
                        </EmptyDataTemplate>
                        <InsertItemTemplate>
                            <span style="">name:
                                <asp:TextBox ID="nameTextBox" runat="server" Text='<%# Bind("name") %>' />
                                <br />
                                website:
                                <asp:TextBox ID="websiteTextBox" runat="server" Text='<%# Bind("website") %>' />
                                <br />
                                details:
                                <asp:TextBox ID="detailsTextBox" runat="server" Text='<%# Bind("details") %>' />
                                <br />
                                outletName:
                                <asp:TextBox ID="outletNameTextBox" runat="server" Text='<%# Bind("outletName") %>' />
                                <br />
                                priority:
                                <asp:TextBox ID="priorityTextBox" runat="server" Text='<%# Bind("priority") %>' />
                                <br />
                                <asp:Button ID="InsertButton" runat="server" CommandName="Insert" Text="Insert" />
                                <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" Text="Clear" />
                                <br />
                                <br />
                            </span>
                        </InsertItemTemplate>
                        <ItemTemplate>
                            <table border="0" width=" 717px">
                                <tr>
                                    <td height="35px" style="font-size: 1.5em; font-weight: bold">
                                        <asp:HyperLink ID="hlOutletName" runat="server"><%# string.concat( Eval("name")," - ",Eval("outletName") ) %></asp:HyperLink>
                           
                                    </td>
                                    <td width="132px">
                                        <asp:Label ID="priorityLabel" runat="server" Text='<%# Eval("priority") %>' Visible="false" />
                                        <asp:Label ID="lblsponsored" runat="server" class="label warning" Text="Sponsored"
                                            Visible="false"></asp:Label>
                                    </td>
                                </tr>
                                <tr>
                                    <td height="35px" colspan="2">
                                        <asp:HyperLink ID="hlWebsite" runat="server" NavigateUrl='<%# Eval("website") %>'><%# Eval("website") %></asp:HyperLink>
                                    </td>
                                </tr>
                                <tr>
                                    <td height="35px" colspan="2">
                                        <asp:Label ID="detailsLabel" runat="server" Text='<%# Eval("details") %>' />
                                        <asp:Label ID="outlet_IDLabel" Visible="false" runat="server" Text='<%# Eval("outlet_ID") %>' />
                                    </td>
                                </tr>
                            </table>
                        </ItemTemplate>
                        <LayoutTemplate>
                            <div style="" id="itemPlaceholderContainer" runat="server">
                                <span runat="server" id="itemPlaceholder" />
                            </div>
                            <div style="">
                            </div>
                        </LayoutTemplate>
                        <SelectedItemTemplate>
                            <span style="">name:
                                <asp:Label ID="nameLabel" runat="server" Text='<%# Eval("name") %>' />
                                <br />
                                website:
                                <asp:Label ID="websiteLabel" runat="server" Text='<%# Eval("website") %>' />
                                <br />
                                details:
                                <asp:Label ID="detailsLabel" runat="server" Text='<%# Eval("details") %>' />
                                <br />
                                outletName:
                                <asp:Label ID="outletNameLabel" runat="server" Text='<%# Eval("outletName") %>' />
                                <br />
                                outlet_ID:
                                <asp:Label ID="outlet_IDLabel" runat="server" Text='<%# Eval("outlet_ID") %>' />
                                <br />
                                priority:
                                <asp:Label ID="priorityLabel" runat="server" Text='<%# Eval("priority") %>' />
                                <br />
                                <br />
                            </span>
                        </SelectedItemTemplate>
                    </asp:ListView>
                    <asp:SqlDataSource ID="SqlDataSourceSearchResults" runat="server" ConnectionString="<%$ ConnectionStrings:yijungoodAnotDBConnectionString %>"
                        SelectCommand="SELECT business.name, business.website, business.details, outlet.name AS outletName, outlet.outlet_ID, outlet.priority FROM business INNER JOIN outlet ON business.business_ID = outlet.business_ID WHERE (outlet.outlet_ID IN (SELECT outlet_1.outlet_ID FROM outlet AS outlet_1 INNER JOIN business AS business_1 ON outlet_1.business_ID = business_1.business_ID WHERE (business_1.name LIKE '%' + @search + '%') OR (outlet_1.name LIKE '%' + @search + '%'))) ORDER BY outlet.priority DESC, (CASE @ascdesc WHEN 'asc' THEN outlet.date_created END), (CASE @ascdesc WHEN 'desc' THEN outlet.date_created END) DESC">
                        <SelectParameters>
                            <asp:QueryStringParameter Name="search" QueryStringField="s" />
                            <asp:ControlParameter ControlID="hfAscDesc" DefaultValue="desc" Name="ascdesc" PropertyName="Value" />
                        </SelectParameters>
                    </asp:SqlDataSource>
                </td>
                <td class="style4">
                    <div id="categorysearchdiv0">
                        <div id="categorysearchheader0">
                            <h2>
                                Category</h2>
                        </div>
                    </div>
                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                        <tr>
                            <td width="50%">
                                <div class="input select">
                                    <asp:DropDownList ID="ddlCategory" runat="server" AutoPostBack="True">
                                        <asp:ListItem>Select  Category</asp:ListItem>
                                        <asp:ListItem Value="Retail">Retail</asp:ListItem>
                                        <asp:ListItem>Fashion &amp; Clothing</asp:ListItem>
                                        <asp:ListItem>Beauty &amp; Sports</asp:ListItem>
                                        <asp:ListItem>Home &amp; Electronics</asp:ListItem>
                                        <asp:ListItem>Entertainment</asp:ListItem>
                                        <asp:ListItem>Night Clubs</asp:ListItem>
                                        <asp:ListItem>Gaming </asp:ListItem>
                                        <asp:ListItem>Cinema</asp:ListItem>
                                        <asp:ListItem>Arts</asp:ListItem>
                                        <asp:ListItem>Education</asp:ListItem>
                                        <asp:ListItem>Tuition Centre</asp:ListItem>
                                        <asp:ListItem>Enrichment Classes</asp:ListItem>
                                        <asp:ListItem>Health &amp; Beauty</asp:ListItem>
                                        <asp:ListItem>Doctors</asp:ListItem>
                                        <asp:ListItem>Dentists</asp:ListItem>
                                        <asp:ListItem>Hospitals</asp:ListItem>
                                        <asp:ListItem>Clinics</asp:ListItem>
                                        <asp:ListItem>Medical Spa / Spa</asp:ListItem>
                                        <asp:ListItem>Massage</asp:ListItem>
                                        <asp:ListItem>Makeup Artist</asp:ListItem>
                                        <asp:ListItem>Pets</asp:ListItem>
                                        <asp:ListItem>Pet Accessories</asp:ListItem>
                                        <asp:ListItem>Veterinarians</asp:ListItem>
                                    </asp:DropDownList>
                                </div>
                            </td>
                        </tr>
                    </table>
                    <br />
                </td>
            </tr>
            <tr>
                <td class="style2">
                    &nbsp;
                </td>
                <td class="style4">
                    &nbsp;
                </td>
            </tr>
        </table>
    </div>
</asp:Content>
